// 订单状态枚举
export type OrderStatus = 1 | 2 | 3; // 1: 使用中, 2: 已归还, 3: 已完成

// API响应中的订单数据结构
export interface OrderItem {
  id: number;
  uid: number;
  using_status: OrderStatus;
  borrow_time: string;
  return_time: string;
  pay_time: string;
  fee: number;
  using_secound: number;
  distanceTime: string;
  delayedStatus: boolean;
  rule_minute_free: number;
  rule_cycle_fee: number;
  rule_minute_cycle: number;
  rule_day_fee: number;
  rule_security_fee: number;
  box1_device_uuid: string;
  single_bank_id: number;
  is_pay: boolean;
  create_time: string;
}

// 用于UI显示的订单状态
export type OrderStatusText = 'renting' | 'pendingPayment' | 'completed';

// 订单详情API返回数据结构
export interface OrderDetailData {
  id: number;
  uid: number;
  uuid: string;
  usingStatus: number; // 1:使用中, 2:已归还, 3:已完成, 4:已购买, 5:已回购
  usingStausText: string;
  borrowTime: string;
  returnTime: string;
  payTime: string;
  buyTime: string;
  createTime: string;
  fee: number;
  securityFee: number;
  distanceTime: string;
  seconds: number;
  model: string;
  check: boolean;
  delayedStatus: boolean;
  delayTime: string;
  delayRemainingTime: string;
  pay_way: string;
  coupon_time: number;
  address: string;
  pwd: any;
  buy: boolean;
  bankAmount: number;
  // 额外字段
  orderId: number;
  distanceTime2: string;
  returnTimeFormt: string;
  buyTimeFormt: string;
  createTimeFormt: string;
  payTimeFormt: string;
  box1_device_uuid: string;
  box1_site_id: number;
  box1_product_id: number;
  single_bank_id: number;
  is_pay: boolean;
}

export interface OrderDetail extends OrderItem {
  // 支付详情
  paymentDetails: {
    orderAmount: number;
    couponDiscount?: number;
    promoDiscount?: number;
    platformDiscount?: number;
    refundAmount?: number;
    taxAmount?: number;
    finalAmount: number;
  };
  // 订单详情
  orderDetails: {
    rentalDate: string;
    returnDate?: string;
    merchantName: string;
    stationId: string;
    powerBankId: string;
  };
  // 计费规则
  billingRules?: string;
}
